<template>
  <div class="app-container-flex">
    <NewFullScreen
      v-model="showDialog"
      :title="title"
      :needOperateAffair="true"
      :operateAffairData="affairTableInfo"
    >
      <div class="model-panel">
        <div class="model-panel-title">
          <p>{{ $t('basic_information') }}</p>
        </div>
        <div class="model-panel-body">
          <basic-information :info="infoList">
            <template v-slot:basic-supDepotValues>
              <span v-if="tableRow.supDepotValues">
                {{ tableRow.supDepotValues.join(',') }}
              </span>
              <span v-else>-</span>
            </template>
          </basic-information>
        </div>
      </div>
    </NewFullScreen>
  </div>
</template>

<script setup name="details">
const { proxy } = getCurrentInstance()
const emits = defineEmits()
const props = defineProps(['visible', 'tableRow'])
// 操作流水
const affairTableInfo = ref({
  query: {
    //数字字典单据类型
    orderType: 107,
    orderId: props.tableRow.id,
    sort: 'operate_time desc',
  },
})
const title = ref('仓库详情')
const infoList = ref({
  data: {},
  fieldList: [
    { label: '仓库名称', value: 'name' },
    { label: '仓库编码', value: 'code' },
    {
      label: '仓库类型',
      value: 'typeValue',
    },
    {
      label: '仓库状态',
      value: 'statusValue',
    },
    {
      label: '可领仓库',
      value: 'supDepotValues',
      type: 'slot',
    },
    { label: '所属部门', value: 'deptName' },
    { label: '仓库管理员', value: 'managerUserName' },
    { label: '预警通知人', value: 'warningNoticeUserName' },
    {
      label: '验证上次批号',
      value: 'validateBatchNumberValue',
    },
    {
      label: '默认使用子盘点',
      value: 'defaultUseSubValue',
    },
    {
      label: '是否允许有库存冻结时盘点',
      value: 'allowFrozenInventoryValue',
    },
    {
      label: '用途类型',
      value: 'useTypeName',
    },
    {
      label: '是否货位管理',
      value: 'isCargoSpaceManageValue',
    },
    {
      label: '备注',
      value: 'remark',
    },
  ],
})

const showDialog = computed({
  get() {
    return props.visible
  },
  set(newValue) {
    emits('update:visible', newValue) // 更新父组件visible
  },
})

onMounted(() => {
  infoList.value.data = props.tableRow
})
</script>

<style scoped></style>
